package com.springboot.mall.controller;

/*
 *
 *订单控制器
 *@data 2022-05-15
 */

import com.springboot.mall.common.ApiRestResponse;
import com.springboot.mall.model.request.CreateOrderRequest;
import com.springboot.mall.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/create")
    public ApiRestResponse createOrder(@RequestBody @Valid CreateOrderRequest createOrderRequest){
        String orderNo = orderService.create(createOrderRequest);
        return ApiRestResponse.success(orderNo);
    }

}
